//package com.shiyi.service;
//
//import com.itextpdf.text.*;
//import com.itextpdf.text.pdf.BaseFont;
//import com.itextpdf.text.pdf.PdfPCell;
//import com.itextpdf.text.pdf.PdfPTable;
//import com.itextpdf.text.pdf.PdfWriter;
//import org.springframework.stereotype.Service;
//
//import java.io.FileOutputStream;
//import java.io.IOException;
//
//@Service
//public class CreatePdfService {
//
//    public Boolean createPdfFile() {
//        Document document = new Document(PageSize.A4);
//        document.setMargins(-50, -50, 15, 5);
//        FileOutputStream fileOutputStream = null;
//        PdfWriter pdfWriter = null;
//        try {
//            fileOutputStream = new FileOutputStream("/Users/tumaxiao/logs/个人就业信息登记表模板.pdf");
//            pdfWriter= PdfWriter.getInstance(document, fileOutputStream);
//            BaseFont bfChinese = null;
//            bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
//
//            Font titlefont = new Font(bfChinese, 16, Font.BOLD);
//            Font keyfont = new Font(bfChinese, 10, Font.BOLD);
//            Font textfont = new Font(bfChinese, 10);
//            document.open();
//
//            PdfPTable usernameInfoPdfPTable = new PdfPTable(1);
//            PdfPCell usernameInfo = new PdfPCell(new Paragraph("个人就业信息登记表模板", titlefont));
//            usernameInfo.setFixedHeight(43);
//            usernameInfo.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
//            //水平垂直居中
//            usernameInfo.setVerticalAlignment(Element.ALIGN_TOP);
//            usernameInfo.setBorder(0);
//            //设置每列宽度比例
//            int[] widthUsername= {100};
//            usernameInfoPdfPTable.setWidths(widthUsername);
//            usernameInfoPdfPTable.getDefaultCell().setBorder(0);
//            usernameInfoPdfPTable.addCell(usernameInfo);
//            document.add(usernameInfoPdfPTable);
//
//            //第三列
//            PdfPTable oneLinePdfPTable = new PdfPTable(6);
//            //设置每列宽度比例
//            int[] oneLineWidthPdfPTable = {14, 12, 14, 12, 14, 14};
//            oneLinePdfPTable.setWidths(oneLineWidthPdfPTable);
//            oneLinePdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell name = new PdfPCell(new Paragraph("姓名", keyfont));
//            PdfPCell username = new PdfPCell(new Paragraph("张三", textfont));
//            PdfPCell sex = new PdfPCell(new Paragraph("性别", keyfont));
//            PdfPCell sexValue = new PdfPCell(new Paragraph("男", textfont));
//            PdfPCell like = new PdfPCell(new Paragraph("爱好", keyfont));
//            PdfPCell likeValue = new PdfPCell(new Paragraph("打篮球", textfont));
//
//            name.setFixedHeight(25);
//            name.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            username.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            sex.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            sexValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            like.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            likeValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//
//            name.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            username.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            sex.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            sexValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            like.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            likeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//
//            oneLinePdfPTable.addCell(name);
//            oneLinePdfPTable.addCell(username);
//            oneLinePdfPTable.addCell(sex);
//            oneLinePdfPTable.addCell(sexValue);
//            oneLinePdfPTable.addCell(like);
//            oneLinePdfPTable.addCell(likeValue);
//            document.add(oneLinePdfPTable);
//
//            PdfPTable twoLinePdfPTable = new PdfPTable(6);
//            int[] twoLineWidthPdfPTable = {14, 12, 14, 12, 14, 14};
//            twoLinePdfPTable.setWidths(twoLineWidthPdfPTable);
//            twoLinePdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell idCard = new PdfPCell(new Paragraph("身份证号码", keyfont));
//            PdfPCell idCardValue = new PdfPCell(new Paragraph("xxxxxxxx", textfont));
//            PdfPCell address = new PdfPCell(new Paragraph("家庭地址", keyfont));
//            PdfPCell addressValue = new PdfPCell(new Paragraph("中国", textfont));
//            PdfPCell health = new PdfPCell(new Paragraph("健康情况", keyfont));
//            PdfPCell healthValue = new PdfPCell(new Paragraph("良", textfont));
//
//            idCard.setFixedHeight(25);
//            idCard.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            idCardValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            address.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            addressValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            health.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            healthValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//
//            idCard.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            idCardValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            address.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            addressValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            health.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            healthValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//
//            twoLinePdfPTable.addCell(idCard);
//            twoLinePdfPTable.addCell(idCardValue);
//            twoLinePdfPTable.addCell(address);
//            twoLinePdfPTable.addCell(addressValue);
//            twoLinePdfPTable.addCell(health);
//            twoLinePdfPTable.addCell(healthValue);
//            document.add(twoLinePdfPTable);
//
//
//            PdfPTable threeLinePdfPTable = new PdfPTable(6);
//            int[] threeLineWidthPdfPTable = {14, 12, 14, 12, 14, 14};
//            threeLinePdfPTable.setWidths(threeLineWidthPdfPTable);
//            threeLinePdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell born = new PdfPCell(new Paragraph("出生日期", keyfont));
//            PdfPCell bornValue = new PdfPCell(new Paragraph("1999年3月3", textfont));
//            PdfPCell home = new PdfPCell(new Paragraph("家庭籍贯", keyfont));
//            PdfPCell homeValue = new PdfPCell(new Paragraph("中国", textfont));
//            PdfPCell cell66 = new PdfPCell(new Paragraph("", textfont));
//            PdfPCell cell67 = new PdfPCell(new Paragraph("", textfont));
//
//            born.setFixedHeight(25);
//            homeValue.setColspan(3);
//            born.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            bornValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            home.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            homeValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            cell66.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            cell67.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//
//            born.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            bornValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            home.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            homeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            cell66.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            cell67.setVerticalAlignment(Element.ALIGN_MIDDLE);
//
//            threeLinePdfPTable.addCell(born);
//            threeLinePdfPTable.addCell(bornValue);
//            threeLinePdfPTable.addCell(home);
//            threeLinePdfPTable.addCell(homeValue);
//            threeLinePdfPTable.addCell(cell66);
//            threeLinePdfPTable.addCell(cell67);
//            document.add(threeLinePdfPTable);
//
//            PdfPTable schoolPdfPTable = new PdfPTable(2);
//            int[] schoolWidthPdfPTable = {7, 33};
//            schoolPdfPTable.setWidths(schoolWidthPdfPTable);
//            schoolPdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell school = new PdfPCell(new Paragraph("学历信息", keyfont));
//            PdfPCell schoolValue = new PdfPCell(new Paragraph("xxxxxxxxxxxxxxx", textfont));
//            school.setFixedHeight(25);
//            school.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            schoolValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            school.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            schoolValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            schoolPdfPTable.addCell(school);
//            schoolPdfPTable.addCell(schoolValue);
//            document.add(schoolPdfPTable);
//
//            PdfPTable internshipPdfPTable = new PdfPTable(2);
//            int[] internshipWidthPdfPTable = {7, 33};
//            internshipPdfPTable.setWidths(internshipWidthPdfPTable);
//            internshipPdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell internship = new PdfPCell(new Paragraph("实习经历", keyfont));
//            PdfPCell internshipValue = new PdfPCell(new Paragraph("xxxxxxxxxxxxxxx", textfont));
//            internship.setFixedHeight(25);
//            internship.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            internshipValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            internship.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            internshipValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            internshipPdfPTable.addCell(internship);
//            internshipPdfPTable.addCell(internshipValue);
//            document.add(internshipPdfPTable);
//
//            PdfPTable jobPdfPTable = new PdfPTable(2);
//            int[] jobWidthPdfPTable = {7, 33};
//            jobPdfPTable.setWidths(jobWidthPdfPTable);
//            jobPdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell job = new PdfPCell(new Paragraph("工作经历", keyfont));
//            PdfPCell jobValue = new PdfPCell(new Paragraph("jvjjjjjjjjjjjjjjhjgfghfghfghfhfhfhfhfh费用分摊方法返回发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发发方法一丰富 u于应付丰富玉夫妇", textfont));
//            job.setFixedHeight(25);
//            job.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            jobValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            job.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            jobValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            jobPdfPTable.addCell(job);
//            jobPdfPTable.addCell(jobValue);
//            document.add(jobPdfPTable);
//
//            PdfPTable telnetPdfPTable = new PdfPTable(2);
//            int[] telnetWidthPdfPTable = {7, 33};
//            telnetPdfPTable.setWidths(telnetWidthPdfPTable);
//            telnetPdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell personTelnet = new PdfPCell(new Paragraph("个人技能", keyfont));
//            PdfPCell personTelnetValue = new PdfPCell(new Paragraph("xxxxxxxxxxxxxxx", textfont));
//            personTelnet.setFixedHeight(25);
//            personTelnet.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            personTelnetValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            personTelnet.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            personTelnetValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            telnetPdfPTable.addCell(personTelnet);
//            telnetPdfPTable.addCell(personTelnetValue);
//            document.add(telnetPdfPTable);
//
//            PdfPTable hobbyPdfPTable = new PdfPTable(2);
//            int[] hobbyWidthPdfPTable = {7, 33};
//            hobbyPdfPTable.setWidths(hobbyWidthPdfPTable);
//            hobbyPdfPTable.getDefaultCell().setBorder(0);
//            PdfPCell hobby = new PdfPCell(new Paragraph("性格爱好", keyfont));
//            PdfPCell hobbyValue = new PdfPCell(new Paragraph("xxxxxxxxxxxxxxx", textfont));
//            hobby.setFixedHeight(40);
//            hobby.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            hobbyValue.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
//            hobby.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            hobbyValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            hobbyPdfPTable.addCell(hobby);
//            hobbyPdfPTable.addCell(hobbyValue);
//            document.add(hobbyPdfPTable);
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            document.close();
//            pdfWriter.close();
//            try {
//                if(fileOutputStream !=null){
//                    fileOutputStream.close();
//                }
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return true;
//    }
//}